home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 1
/
PC World Interactive 1 - Nisan 1997.iso
/
nostalji
/
bbs
/
dos
/
ap2m.arj
/
2M-TECH.DOC
< prev
next >
Wrap
Text File
|
1994-04-30
|
12KB
|
213 lines
TECHNICAL INFORMATION FOR PROGRAMMERS
-------------------------------------
2M access always directly to NEC765 diskette controller chip and 8237
DMA controller. But you haven't to do the same!. The standard DOS and BIOS
functions still works when 2M is installed, supporting new diskette formats
as standard ones. If you need to format a 2M diskette from your high-level
applications, this is possible also via standard INT 13h function 5.
When 2M is installed on memory, INT 13h service 5 becomes increased
its functionality. To find 2M resident on memory:
Load AL with 0.
Load ES:DI with 1492h:1992h.
Load AH with a value from 0C0h to 0FFh.
Call INT 2Fh.
When INT 2Fh returns, if AL=0FFh and ES:DI points a "CiriSOFT:2M:2.0"
null terminated string... 2M is in memory!. Note that ':' is a delimiter
and not always CiriSOFT will be the manufacturer (I recomend search only
for the ":2M:" substring). You can begin scanning with AH=0C0h and, if not
found 2M there, continue with AH=0C1h and so on. If 2M has been loaded from
booting a 2M disk, format functions are not available (and 2M installation
check will correctly fail).
When you had detected 2M on memory, you can call to INT 13h function
5 to format a diskette track. This is easiest than standard BIOS service:
you don't need to select the disk density, media, or last sector in the
track. Of course, the standard BIOS function is still available but you can
call INT 13h as bellow:
Load AH with 5.
Load AL with 7Fh.
Load CH with track number.
Load DH with head number.
Load DL with drive number.
Load SI with 324Dh signature ("2M").
Load ES:BX pointing to boot sector of future 2M diskette.
Note that in standard BIOS call, AL sets the number of sectors (never
is 7Fh) and SI is not necesary equal to 324Dh. This lets 2M to detect your
intention. You have not to fill big tables on ES:BX, simply point to a boot
sector of future diskette. This boot sector can be obtained from standard
2M diskette already formatted. New INT 13h format function return the sames
codes in AH that the BIOS standard routines. Since 2.0 version of 2M, the
track 0 head 0 contains a virtual BOOT sector in the first physical sector
of FAT2, and in high and extra-high density diskettes the SuperBOOT code in
the second-sixth sectors of FAT2. The FAT2 is emulated using FAT1 instead.
The real BOOT sector is never shown in BIOS normal functions, and SuperBOOT
code also can not be accessed through BIOS standard functions. The virtual
boot sector is equal to real one when 2MF formats a diskette, but can be
altered by SYS command, for example. If you desire to format a 2M diskette,
and you want to make this diskette capable of SuperBOOT, you must write the
real BOOT sector, the virtual BOOT sector *AND* the SuperBOOT code. This is
possible using a little trick: when calling standard BIOS functions (read &
write), select the 128 or 129 head (instead 0 and 1 ones). This lets 2M to
know your intention, and physical sectors will be read or written without
emulations. Note that first track of 2M diskette has less sectors than the
rest, so you must access no more than 1 (boot) + N (FAT1) + 1 (the virtual
BOOT) + 5 (SuperBOOT code) = 7 + N sectors ... and with double density only
must be accessed boot, FAT1 and virtual BOOT (no SuperBOOT code!).
If disk is formatted using the STV technology (when offset 65 of boot
record is equal to 1) the completely track must be written after format to
avoid future CRC errors on read. This does not is necessary on cylinder 0
side 0. In cylinder 0 side 1 the track must be write using head 81h instead
head 1. STV technology is used by 2MF if /M switch is present.
You don't need to build your own boot sectors, buf if you decide to
modify something, you must know:
- 2M diskettes have always TWO FAT copies, for hardware reasons. Do
not try to alter this specification (yes, for *hardware* reasons).
- Modifing system ID probably makes 2M not able to detect the diskette,
and standard BIOS will report sector-not-found errors.
- Yoy can modify the jump instruction at the begin of boot, and the
boot code located after destination of this jump. But data located
from offset 63 to last byte before boot code is covered by checksum,
and you have to compute it if you modify something (the arithmetic 8
bits add off all bytes must be zero, use checksum byte to force it).
- Resuming: you can only modify offsets from 0 to 2, from 11 to 61 (it
is not recommended) and the boot code.
- If you try to write a boot sector with 2M installed, you will really
write the virtual boot sector, instead the real one. With 2M loaded
on memory, the real boot sector can be modified only invocating BIOS
write function in head 128 or 129 (instead 0-1). The virtual boot
sector is located on first sector of the second FAT copy (when 2M is
loaded, all BIOS access to second copy of FAT are emulated using the
first copy instead). This trick makes 2M compatible with DOS SYS
command. And much more, the first track of 2M diskette has the DOS
standard format, with less space free where don't have room to place
the completely FAT2.
- If the boot sector has a invalid checksum, a 'seek error' will be
reported.
- The virtual boot sector can be modify without problem, inside of the
reason limits. Note that with 2M installed you can access to this
sector via standard DOS functions (sector 0) or BIOS (track 0 head 0
and sector 1), never through FAT2 ... this is *emulated* by 2M (this
emulation is only skipped while using head 128-129 instead 0-1).
Here are the format of 2M diskettes, in order to meet your curiosity;
2M is not a secret or magic program!. See the source code files for more
information (if you don't understand the source code comments, you may come
to Spain next summer :) ).
* BOOT SECTOR OF 2M DISKETTE (COMMON TO ALL FORMATS).
Assembler Comment Offset
--------------------- ---------------------------------- ----------
JMP BootP ; 3 bytes 0
DB "2M-STV08" ; system ID of 2M 1.80M diskette 3
DW 512 ; bytes per sector 11
DB 1 ; sectors per cluster 13
DW 1 ; sectors reserved at beginning 14
DB 2 ; number of FAT copies 16
DW 224 ; root directory entries 17
DW 3772 ; total sectors on disk 19
DB 0F0h ; media descriptor 21
DW 11 ; sectors ocupied by each FAT 22
DW 23 ; sectors per track 24
DW 2 ; number of heads 26
DD 0 ; special sectors reserved 28
DD 0 ; number of sectors (32 bit drives) 32
DB 0 ; physical drive 36
DB 0 ; reserved 37
DB 29h ; DOS >= 4.0 diskette 38
DD 4B368A0Eh ; serial number (random) 39
DB "NO NAME " ; disk label 43
DB "FAT12 " ; FAT type 54
DB 0 ; reserved by 2M 62
DB 0 ; 2M checksum (if used) 63
DB 7 ; format version (>=7 if virtual BOOT) 64
DB 1 ; 1 if write track after format 65
DB 0 ; data transfer rate on track 0 66
DB 0 ; data transfer rate on track<>0 67
DW BootP ; offset to boot program 68
DW Infp0 ; T1: information for track 0 70
DW InfpX ; T2: information for track<>0 72
DW InfTm ; T3: tracks sectors size table 74
* NORMAL FORMATS (820/1476/984/1804K). FOR EXAMPLE: 1804K.
Infp0 DB 19, 70 ; number of sectors / GAP 3 for format
DB 1,2,3,4,5,6,7,8 ; sectors ordered (20..22 does not exist)
DB 9,10,11,12,13,14
DB 15,16,17,18,19
InfpX DB 11, 40 ; number of sectors / GAP3 for format
DB 3 ; sector size
DB 1, 2 ; sector slidding (override by 2MF /X /Y)
InfTm DB 3,3,3,3,3,3 ; size of sectors 1, 2, 3,...
DB 3,3,3,3,3
BootP:... ; SuperBOOT loader
* MAXIMUM CAPACITY FORMATS (902/1558/1066/1886K). FOR EXAMPLE: 1886K.
Infp0 DB 19, 70 ; number of sectors, GAP3 for format
DB 1,2,3,4,5,6,7,8 ; sectors ordered (20..23 does not exist)
DB 9,10,11,12,13,14
DB 15,16,17,18,19
InfpX DB 64, 3 ; number of sectors / GAP3 for preformat
DB 7 ; number of sectors to renum
DB 128+1, 4, 4 ; renum table:
DB 128+12, 1, 4 ; number of sector, new number, size
DB 128+23, 5, 4
DB 128+34, 2, 4
DB 128+45, 6, 3
DB 128+51, 3, 4
DB 128+62, 7, 2
InfTm DB 4,4,4,4,4,3,2 ; size of sectors 1, 2, 3,...
BootP:... ; SuperBOOT loader
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2M format function in Ralf Brown Interrupt List format:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
--------B-13057FSI324D-----------------------
INT 13 - 2M - FORMAT TRACK
AX = 057Fh
SI = 324Dh ("2M")
CH = track number
DH = head number
DL = drive number
ES:BX -> boot sector of future 2M diskette
Return: CF set on error
CF clear if successful
AH = status (see AH=01h)
Program: 2M is a TSR developed by Ciriaco Garcia de Celis to support
non standard diskettes with 820-902/1476-1558K (5.25 DD/HD)
and 984-1066/1804-1886K/3608-3772K (3.5 DD/HD/ED)
Notes: it is not necessary to call AH=17h/AH=18h first (will be ignored)
diskette format must begin always on cylinder 0 head 0
the installation check for 2M must search a "CiriSOFT:2M:2.0" string or
similar (recomended ":2M:" substring) in CiriSOFT TSR interface
the boot sector can be obtained from a 2M diskette already formatted if
reading (AH=02h) with head number 80h since 2M 2.0 (else use head 0)
since 2.0 version of 2M, the BOOT sector is emuled using first physical
sector of FAT2; the second-sixth physical sectors of FAT2 in HD or ED
diskettes store the SuperBOOT code. To skip the FAT2 emulation (using
FAT1) of 2M, in order to read the SuperBOOT code, head number must be
80h-81h instead 0-1 (bit 7 active) in standard read/write functions.
This lets diskcopy programs to format 2M target diskettes copying
SuperBOOT code. If target diskette is already 2MF formatted (provided
of boot code) this trick it is not necessary
when using STV technology (offset 65 of boot sector equal to 1) it is
necessary to write the full track before formatting (except track 0
side 0) to complete the format and skip future CRC errors on read; in
track 0 side 1 the head used must be 81h instead 1. Diskcopy programs
may do a format-write-verify secuential phases to improve performance
SeeAlso: AH=05h"FLOPPY",INT 2F"CiriSOFT TSR interface"